package com.restaurant.application.indexes.customerlist.support;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import java.lang.String;
import java.util.List;

public class CustomerIdData implements PickableBean {
    
    public static final String FN_ID = "id";
    
    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_ID);
    
    private String id;
    
    public CustomerIdData(String id) {
        setId(id);
    }
    
    public CustomerIdData() {
    }
    
    public CustomerIdData duplicate() {
        CustomerIdData result = new CustomerIdData();
        result.id = this.id;
        return result;
    }
    
    @Override
    public String toString() {
        return Convert.toJson(this);
    }
    
    public String getId() {
        return id;
    }
    
    public void  setId(String value) {
        this.id = value;
    }
    
    public CustomerIdData withId(String value) {
        setId(value);
        return this;
    }
    
    public CustomerIdData withId(String value, String defaultValue) {
        setId(value == null ? defaultValue : value);
        return this;
    }
    
    public Object getValueOf(String name) {
        switch(name) {
        case "id": return getId();
        }
        return null;
    }
    
    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }
    
    @Override
    public int hashCode() {
        return signature().hashCode();
    }
    
    @Override
    public boolean equals(Object o) {
        if(!(o instanceof CustomerIdData)) return false;
        return signature().equals(((CustomerIdData)o).signature());
    }
    
    public String signature() {
        throw new RuntimeException("Bean CustomerIdData has no signature defined, no hash code or equals possible.");
    }
}
